<template>
  <f7-page>
    <f7-navbar title="吉林动画学院红头文件申请表" back-link=""></f7-navbar>
    <f7-list inline-labels no-hairlines-md>
      <f7-list-item title="名称" v-bind:after="item.title"></f7-list-item>
      <f7-list-item title="创建时间" v-bind:after="item.creationDate"></f7-list-item>
      <f7-list-item title="申请部门" v-bind:after="item.orgName"></f7-list-item>
      <f7-list-item title="申请时间" v-bind:after="item.applyDate"></f7-list-item>
      <f7-list-item title="文    号" v-bind:after="item.businessNo"></f7-list-item>
      <f7-list-item title="文号类型" v-bind:after="issueNum[item.docType]"></f7-list-item>
      <f7-list-item title="文件状态" v-bind:after="item.docStatus"></f7-list-item>
      <f7-list-item title="申 请 人" v-bind:after="item.createBy"></f7-list-item>
      <f7-list-item  v-bind:text="item.docContent">
        <f7-label>发文内容</f7-label>
        <f7-input type="textarea" placeholder="Input here please" :value="item.docContent" :disabled="true"></f7-input>
      </f7-list-item>
      <f7-list-item title="审批选项">
        <f7-toggle color="orange" disabled :checked="item.needHeader" ></f7-toggle>
      </f7-list-item>
    </f7-list>
    <f7-list v-show="item.needHeader">
      <f7-list-item title="校领导审批名单" v-if="isShowSuperior" v-bind:after="item.needManagerUser"></f7-list-item>
      <f7-list-item title="部门负责人签字" v-bind:after="item.depUser"></f7-list-item>
      <f7-list-item title="校务部签字" v-bind:after="item.schoolUser"></f7-list-item>
      <f7-list-item title="校领导签字" v-bind:after="item.managerUser"></f7-list-item>
      <f7-list-item title="董事长签字" v-bind:after="item.chairmanUser"></f7-list-item>
    </f7-list>

    <f7-block-title></f7-block-title>
    <f7-list>
      <f7-list-item title="流程历史" v-bind:link="'/oa/activities/' + item.processInstanceId"></f7-list-item>
    </f7-list>
    <f7-block-title></f7-block-title>
    <f7-list>
      <f7-list-item title="附件数据" v-bind:link="'/oa/attachments/' + item.id"></f7-list-item>
    </f7-list>
  </f7-page>
</template>
<script>

export default {
  data () {
    return {
      item: {},
      issueNum : [
        "吉动院人字",
        "吉动院教字",
        "吉动院学字",
        "吉动院招字",
        "吉动院研字",
        "吉动院学位字",
        "吉动院研学字",
        "吉动校友字"
        ]
    }
  },
  created () {
    this.$f7ready((f7) => {
      let id = this.$f7route.params.id;
      let that = this;
      f7.request.setup({
        headers: {
          'AccessToken': sessionStorage.getItem('accessToken'),
          'JSESSIONID': sessionStorage.getItem('userToken')
        }
      });
      if (id !== undefined) {
        f7.request.json(that.GLOBAL.RequestAddress + '/camel/rest/redheadapplys/' + id, {}, function (result) {
          if (result.success === undefined) {
            that.item = result;
            console.log(that.item.needManagerUser.length)
          }
        });
      }
    });
  },
  computed:  {
    extDocType: function () {
      var businessNo = String(this.item.businessNo);
      return businessNo.split('[')[0];
    },
    isShowSuperior:function () {
      if(this.item.needManagerUser!== undefined && this.item.needManagerUser.length == 0 ) {
        return false;
      } else {
        return true;
      }
    }
  }
}
</script>
